package club.cearnach.api.dao;

import club.cearnach.entity.Comment;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * @author 阮胜
 * @date 2018/5/15 23:43
 */
public interface ICommentDao extends JpaRepository<Comment, Integer> {
    /**
     * 根据MovieId查询
     *
     * @param id
     * @param pageable
     * @return
     */
    Page<Comment> findByMovieId(Integer id, Pageable pageable);

    /**
     * 根据MovieId删除
     *
     * @param id
     */
    void deleteByMovieId(Integer id);

    /**
     * 根据id批量查询
     * @param ids
     * @return
     */
    List<Comment> findByIdIn(Integer... ids);
}
